package com.example.account.service.impl;

import com.example.account.mapper.AccountDetailMapper;
import com.example.account.service.AccountDetailService;
import com.example.commons.exception.BusinessException;
import com.example.commons.id.Serial;
import com.example.commons.time.TimeTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountDetailServiceImpl implements AccountDetailService {
    @Autowired
    AccountDetailMapper accountDetailMapper;

    @Override
    public void addAccountDetail(String userId, String bal, String afterBal, int payType, int type, String remarks, String explains) {
        if (1 != accountDetailMapper.addAccountDetail(Serial.getOrderId(userId),userId, bal, afterBal, payType, type, TimeTools.getTime(), remarks, explains)) {
            throw new BusinessException("明细记录失败");
        }
    }
}
